package jsyf.oa.web.report.newAppReport;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.newAppReport.NewAppReportForZSQFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Api(value = "全新的APP报表FOR总经理/销售总监/区域总监", description = "全新的APP报表FOR总经理/销售总监/区域总监")
@Controller
@RequestMapping("/newAppReportForZSQ")
public class NewAppReportForZSQController {

    @Resource
    private NewAppReportForZSQFacade newAppReportForZSQFacade;

    @ResponseBody
    @RequestMapping(value = "/getTodayPlanByUserIdAndDateTimeForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日第二天计划",
            notes = "今日第二天计划",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayPlanByUserIdAndDateTimeForZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getTodayPlanByUserIdAndDateTimeForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodaySignForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日考勤签到",
            notes = "今日考勤签到",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodaySignForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getTodaySignForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodayFirstVisitAndSignForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日首次面访",
            notes = "今日首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayFirstVisitAndSignForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getTodayFirstVisitAndSignForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getBRMTodayFirstVisitAndSignForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理首次面访",
            notes = "大区经理首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getBRMTodayFirstVisitAndSignForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getBRMTodayFirstVisitAndSignForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getTodayFirstVisitAndSignForBRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理下属首次面访",
            notes = "大区经理下属首次面访",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayFirstVisitAndSignForBRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getTodayFirstVisitAndSignForBRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getVisitByUserIdAndDateTimeForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日面电访",
            notes = "今日面电访",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面,status//0-AM/1-PM}", dataType = "String", paramType = "body")
    })
    public void getVisitByUserIdAndDateTimeForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getVisitByUserIdAndDateTimeForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getCostByUserIdAndDateTimeForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日费用",
            notes = "今日费用",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getCostByUserIdAndDateTimeForZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getCostByUserIdAndDateTimeForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserIdForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日工作报告",
            notes = "今日工作报告",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getEmailByUserIdForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getEmailByUserIdForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getLeaveReasonByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取请假信息",
            notes = "获取请假信息",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    public void getLeaveReasonByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getLeaveReasonByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getVisitByUserIdAndDateTime.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "面电访信息",
            notes = "面电访信息",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd',type//0-电/1-面,status//0-AM/1-PM}", dataType = "String", paramType = "body")
    })
    public void getVisitByUserIdAndDateTime(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getVisitByUserIdAndDateTime(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getBRMEmailForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区经理工作报告",
            notes = "大区经理工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getBRMEmailForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getBRMEmailForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRDEmailForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域总监工作报告",
            notes = "区域总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getRDEmailForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getRDEmailForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSDEmailForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售总监工作报告",
            notes = "销售总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getSDEmailForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSDEmailForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRegionIdByUserIdForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取区域",
            notes = "获取区域",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getRegionIdByUserIdForZSQ(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getRegionIdByUserIdForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserIdForRM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域经理工作报告",
            notes = "区域经理工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getEmailByUserIdForRM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getEmailByUserIdForRM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getEmailByUserIdForRTL.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域组长工作报告",
            notes = "区域组长工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getEmailByUserIdForRTL(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getEmailByUserIdForRTL(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRoleNameByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取roleName",
            notes = "获取roleName",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId}", dataType = "String", paramType = "body")
    })
    public void getRoleNameByUserId(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getRoleNameByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    //--------------------区域总监/总经理报表----------------------------------------
    @RequestMapping(value = "/getCalendar.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取本月请假日期",
            notes = "获取本月请假日期",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getCalendar(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> result = newAppReportForZSQFacade.getCalendar(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(result));
    }

    @RequestMapping(value = "/getSignByMyself.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域总监自己",
            notes = "区域总监自己",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByMyself(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByMyself(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @RequestMapping(value = "/getSignForZZRegionZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域组长",
            notes = "区域组长",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignForZZRegionZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignForZZRegionZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @RequestMapping(value = "/getSignByUserIdAndDateTimeForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日签到报表",
            notes = "今日签到报表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByUserIdAndDateTimeForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @RequestMapping(value = "/getSignByBigUserIdAndDateTimeForZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "今日签到报表",
            notes = "今日签到报表",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByBigUserIdAndDateTimeForZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByBigUserIdAndDateTimeForZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSignByUserIdAndDateTimeForTOPZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域总监签到",
            notes = "区域总监签到",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForTOPZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByUserIdAndDateTimeForTOPZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @RequestMapping(value = "/getSignByUserIdAndDateTimeForXSZJZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售总监签到",
            notes = "销售总监签到",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForXSZJZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByUserIdAndDateTimeForXSZJZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @RequestMapping(value = "/getSignByUserIdAndDateTimeForQYZCZSQ.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域支持签到",
            notes = "区域支持签到",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getSignByUserIdAndDateTimeForQYZCZSQ(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSignByUserIdAndDateTimeForQYZCZSQ(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
    @ResponseBody
    @RequestMapping(value = "/getTodayPlanByRoleName.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取第二天计划通过RoleName",
            notes = "获取第二天计划通过RoleName",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getTodayPlanByRoleName(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getTodayPlanByRoleName(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @ResponseBody
    @RequestMapping(value = "/getRSEmailForXM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域支持工作报告",
            notes = "区域支持工作报告",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{'userId':'','dateTime':'yyyy-MM-dd'}", dataType = "String", paramType = "body")
    public void getRSEmailForXM(HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getRSEmailForXM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getSDEmailForXM.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "销售管理看销售总监工作报告",
            notes = "销售管理看销售总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getSDEmailForXM(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getSDEmailForXM(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }

    @RequestMapping(value = "/getRDEmailForRS.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "区域支持查看区域总监工作报告",
            notes = "区域支持查看区域总监工作报告",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "{userId,dateTime}", dataType = "String", paramType = "body")
    })
    public void getRDEmailForRS(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject result = newAppReportForZSQFacade.getRDEmailForRS(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjTimeRespond(result));
    }
}

